import Link.LinkListClass;
import Link.LinkNode;

public class li213 {
    public static void Reverse(LinkListClass<Integer> L){
        LinkNode<Integer>p = L.head.next,q;
        L.head.next =null;
        while(p!=null){
            q=p.next;
            p.next = L.head.next;
            L.head.next = p;
            p=q;
        }
    }
    public static void main(String args[]){
        LinkListClass<Integer> test = new LinkListClass<>();
        test.Add(1);
        test.Add(2);
        test.Add(3);
        test.Add(4);
        test.Add(5);
        for (int i = 0;i< test.size();i++){
            System.out.print(test.GetElem(i));
        }
        System.out.println();
        Reverse(test);
        for (int i = 0;i< test.size();i++){
            System.out.print(test.GetElem(i));
        }

    }
}
